import { Dictionary } from "@/types";
import http from "@/utils/requests";

/**
 * 用户注册
 * @returns
 */
export function register(data: Dictionary<string>) {
  return http({
    url: "/api/user/register",
    method: "post",
    data,
  });
}

/**
 * 用户登录
 * @returns
 */
export function login(data: Dictionary<string>) {
  return http({
    url: "/api/user/login",
    method: "post",
    data,
  });
}

/**
 * 用户刷新Token
 * @returns
 */
export function refresh(params: Dictionary<string>) {
  return http({
    url: "/api/user/refresh",
    method: "get",
    params,
  });
}

/**
 * 获取当前登录用户信息
 * @returns
 */
export function self() {
  return http({
    url: "/api/user/self",
    method: "get",
  });
}
